/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package astroLib;

import astroLib.APC_Vect3D.Polar;
import astroLib.APC_Vect3D.Vec3D;

/**
 *
 * @author mgeden
 */
public class APC_Spheric{
    
    
    //------------------------------------------------------------------------------
//
// Equ2Hor: Transformation of equatorial coordinates to the horizon system
//
// Input:
//
//   Dec       Declination
//   tau       Hour angle
//   lat       Geographical latitude of the observer
//
// Output:
//
//   h         Altitude
//   Az        Azimuth
//
// Note: all parameters in [rad]
//
//------------------------------------------------------------------------------
Horizontal Equ2Hor ( double Dec, double tau, double lat)
{
  //
  // Variables
  //
  Vec3D e_equ;
  Polar  e_hor;
  Horizontal result;
  Polar polar=new Polar(tau,Dec);

  e_equ = new Vec3D(polar);          // unit vector in horizontal system
  // e_equ = {m_Vec = {0.58881464761003832, -0.38575765187682981, 0.71027342958774764}, m_phi = -0.57998202437182178, m_theta = 0.78988656845716043, m_r = 1, m_bPolarValid = true}
  // R_y(pi/2.0-lat)={m_Mat = {{0.74431154623115414, 0, -0.66783255547104659}, {0, 1, 0}, {0.66783255547104659, 0, 0.74431154623115414}}}      
  e_hor=APC_Vect3D.calcPolarAngles (APC_Vect3D.AbProduct(APC_Vect3D.R_y(Math.PI/2.0-lat), e_equ)); // unit vector in equatorial system
  //  e_hor = {m_Vec = {-0.036082178758590183, -0.38575765187682981, 0.92189430543555695}, m_phi = 0, m_theta = 0, m_r = 0, m_bPolarValid = false}

  result= new Horizontal ();
  
  result.Az =e_hor.phi;                     // polar angles4.6191244648066796
  result.h  =e_hor.theta;                   //1.1729416588203474
  
 return result;
  
}

 

}
